<template>
<base-breadcrumb :breadcrumb="!isAudit">
<a-card>
      <title-name title="考核信息"></title-name>
      <a-form-model
        ref="ruleForm"
        :label-col="{span: 6 }"
        :wrapper-col="{span: 18 }"
        :rules="rules"
        :model="form"
        >
        <a-row>
        <a-col :md="24" :sm="24">
          <a-form-model-item label="所属单位" prop="branchCompany">
              <BaseInput :value="unit" disabled></BaseInput>
          </a-form-model-item>
        </a-col>
<!--        <a-col :md="12" :sm="12">-->
<!--          <a-form-model-item label="项目名称"  prop="projectId">-->
<!--              <BaseInput v-model="form.projectName" disabled></BaseInput>-->
<!--          </a-form-model-item>-->
<!--        </a-col>-->
          <a-col :md="12" :sm="12">
            <a-form-model-item  label="分包商" prop="subContractorId">
              <BaseInput v-model="form.subContractorName" disabled></BaseInput>
            </a-form-model-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-model-item label="考核评价" prop="evaluate">
              <BaseInput  v-model="form.evaluate" disabled></BaseInput>
            </a-form-model-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-model-item label="审核类型" prop="type">
              <BaseInput  v-model="form.type" disabled></BaseInput>
            </a-form-model-item>
          </a-col>
          <a-col :md="24" :sm="24">
            <a-form-model-item label="情况说明" prop="information">
              <BaseTextarea disabled v-model="form.information" type="textarea"  placeholder="请输入" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
      <title-name title="相关证明附件"></title-name>
      <div>
        <a-row>
          <a-col :md="24" :sm="19">
            <div class="table-operator">
              <a-row>
                <a-col :span="24">
                    <a-form-model-item
                        label="附件上传"
                        :label-col="{ lg: 2, md: 3, sm: 3 }"
                        :wrapper-col="{ lg: 22, md: 21, sm: 21 }">
                        <div>
                            <upload-list
                                :businessCode="'PM11'"
                                :editModel="2"
                                :isClose=false
                                :disabled="form.types=='view'"
                                :uploadArrys.sync="form.proveCommonIdList"
                                multiple
                            ></upload-list>
                        </div>
                    </a-form-model-item>
                </a-col>
              </a-row>
            </div>
          </a-col>
        </a-row>
      </div>
</a-card>
<a-button v-if="!isConsultation" style="float:right" class="page-btn-right-top" type="primary" @click="goBack">关闭</a-button>
</base-breadcrumb>
</template>
<script>
  import { getDetails} from '@/api/subcontractors/managerAssessment'
  import UploadList from '@/components/UploadList'
  import {getStatusCodeData } from '@/api/subcontractors/labor'
  import { getSubcontractorsList } from '@/api/subcontractors/standing'
  import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
  import SelectProject from '@/components/Select/SelectProject' // 项目
  const  columnApprove = [
    {
      title: '审批序号',
      scopedSlots: { customRender: 'serial' }
    },
    {
      title: '审批人',
      dataIndex: '',
    },
    {
      title: '审批时间',
      dataIndex: '',
    },
    {
      title: '节点名称',
      dataIndex: '',
    },
    {
      title: '滞留时间',
      dataIndex: '',
    },
    {
      title: '审批意见',
      dataIndex: '',
    },
    {
      title: '操作',
      dataIndex: 'operation',
      scopedSlots: { customRender: 'operation' }
    }
  ]

export default {
    components:{
      UploadList,
      SelectSubCompany,
      SelectProject
    },
    props: {
      // 是否作为审批详情
      isAudit: {
        type: Boolean,
        default: false
      },
      // 是否作为意见征询
      isConsultation: {
        type: Boolean,
        default: false
      }
    },
  data(){
    return{
      id:"",
      form:{},
      isClose:false,
      columnApprove,
      formApprove:{},
      forms:{},
      visible:false,
      title:'',
      dataSource:[],
      typeList:[],
      statusCodes:[],
      subList:[],
      rules: {  },
      type:'',
      unit: ''
    }
  },
  created(){
    this.id = this.$route.query.id
    this.form.types = this.$route.query.id
    this.type = this.$route.query.type
    this.getDetails()
    this.getStatusCodeData()
    console.log(this.form)
  },
  methods:{
    getDetails(){
      getDetails({id:this.id}).then(res=>{
          this.form = res.data
          // this.form.branchCompany = this.form.branchCompanyId
          // this.form.evaluate = res.data.evaluateId
          // this.form.type = res.data.typeId
          // this.form.types=type
          this.form.proveCommonIdList = res.data.proveFileList
          this.unit = this.form.branchCompany + '/' + this.form.projectName
          // this.isClose = false
      })
    },
    goBack(){
      let that = this;
      if(that.type == 'approve'){
        window.close()
      }else{
        that.$multiTab.close(that.$route.fullpath)
      }
    },
    getStatusCodeData(){
      getStatusCodeData({type:6}).then(res=>{
          this.typeList = res.data
      })
    },
    handleCancel(){

    }
  }
}
</script>
